<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    {% load static %}
    <title>influx</title>
    <link rel="stylesheet" href="{% static 'plugins/bootstrap-3.4.1-dist/css/bootstrap.css' %}">
    <script src="{% static 'js/jquery-3.7.0.min.js' %}"></script>
    <script src="{% static 'plugins/bootstrap-3.4.1-dist/js/bootstrap.min.js' %}"></script>
    <script src="/static/js/get_all_list.js"></script>
    <style type="text/css">
        .line1{
            left:100px;
            width:850PX;
            height:5px;
            border:none;
            border-top:1px solid #e7ebe7;
        }
        .form-inline .form-control {
             display: inline-block;
             width: 300px;
             vertical-align: middle;
        }
        .warning{
             left: 560px;
             position:absolute;
        }
        .warning2{
             left: 1000px;
             position:absolute;
        }
        .modal-dialog {
             width: 900px;
             margin: 30px auto;
        }
        .navbar{
            border-radius: 0;
        }

    </style>
</head>
<body>
{% include 'head.html' %}
<div>
    <div class="container">
        <!--        <div>-->
        <!--            <h1 class="control-label">造数1表单</h1>-->
        <!--        </div>-->
        <form class="form-horizontal" role="form" method="post" action="/influx2/" onsubmit="return check(this)">
            {% csrf_token %}
            <div class="panel panel-info">
                <div class="panel-heading">
                    <h3 class="panel-title">基本信息</h3>
                </div>
                <div class="panel-body">
                    <div class="form-inline">
                        <label class="col-md-2 control-label ">IP</label>
                        <input type="text" class="form-control" id="IP"
                               placeholder="请输入IP" name="IP" value="{{data.IP}}">
                        <span style="color:red; display:none" id="inputIP">请输入IP</span>
                    </div>
                    <div class="form-inline" style="margin-top:10px">
                        <label class="col-md-2 control-label">ProjectID</label>
                        <input class="col-md-1 form-control" id="PID" type="text" placeholder="project id"
                               name="PID" value="{{ data.PID }}">
                        <label class="col-md-2 control-label">IDS</label>
                        <input class="col-md-1 form-control" id="IDS" type="text" placeholder="ids" name="IDS"
                               value="{{ data.IDS }}">
                    </div>
                </div>
            </div>
            <div class="panel panel-info">
                <div class="panel-heading">
                    <h3 class="panel-title">时间设置</h3>
                </div>
                <div class="panel-body">
                    <div class="form-inline">
                        <label class="col-md-2 control-label">开始时间</label>
                        <input class="col-md-3 form-control control-label " id="disabledInput" type="date"
                               placeholder="YYYY-MM-DD HH:MM:SS" name="StartTime" value="{{data.StartTime}}">
                        <label class="col-md-2 control-label">天数</label>
                        <input class="col-md-2 form-control" id="Days" type="text" placeholder="多少天" name="Days"
                               value="{{ data.Days }}">
                    </div>

                    <div class="form-inline" style="margin-top:45px">
                        <label class="col-md-2 control-label">间隔：小时</label>
                        <input class="col-md-1 form-control" id="hours" type="text" placeholder="小时" name="Hours"
                               value="{{ data.Hours }}">
                        <label class="col-md-2 control-label">分钟</label>
                        <input class="col-md-1 form-control" id="minutes" type="text" placeholder="分钟" name="Minutes"
                               value="{{ data.Minutes }}">
                    </div>
                    <div class="form-inline" style="margin-top:90px">
                        <label class="col-md-2 control-label">秒</label>
                        <input class="col-md-2 form-control" id="seconds" type="text" placeholder="秒" name="Seconds"
                               value="{{ data.Seconds }}">
                    </div>
                </div>
            </div>
            <div class="panel panel-info">
                <div class="panel-heading">
                    <h3 class="panel-title">数据设置</h3>
                </div>
                <div class="panel-body">
                    <div class="form-inline">
                        <label class="col-md-2 control-label ">数据类型</label>
                        <select class="form-control" id="type"
                                name="DataType" value="{{ data.DataType }}">
                            <option value="float">float</option>
                            <option value="Integer">Integer</option>
                        </select>
                    </div>
                    <div class="form-inline" style="margin-top:10px">
                        <label class="col-md-2 control-label">基础数</label>
                        <input class="col-md-2 form-control" id="baseNumber" type="text" placeholder="基础数"
                               name="BaseNumber" value="{{ data.BaseNumber }}">
                        <label class="col-md-2 control-label">浮动范围</label>
                        <input class="col-md-2 form-control" id="range" type="text" placeholder="浮动上限" name="Range"
                               value="{{ data.Range }}">
                    </div>
                    <div class="form-group" style="margin-top:0px">
                        <div class="checkbox col-md-2 control-label">
                            <label>
                                <input id="ifAdd" type="checkbox" class="control-label" name="ifAdd" value="{{ data.ifAdd }}"> 递增
                            </label>
                        </div>
                    </div>
                    <div class="form-inline" style="margin-top:0px">
                        <label class="col-md-2 control-label">步长</label>
                        <input class="col-md-2 form-control" id="step" type="text" placeholder="步长" name="Step"
                               value="{{ data.Step }}">
                    </div>
                    <div class=" col-md-1 col-md-offset-1 control-label">
                        <button type="submit" class="btn btn-primary " name="Submit" value="CreateDB">造数</button>
                    </div>
                    <div class=" col-md-1  control-label">
                        <button type="submit" class="btn btn-info " name="Submit" value="SearchDB">查询</button>
                    </div>
                    <div class=" col-md-1  control-label">
                        <button type="submit" class="btn btn-warning " name="Submit" value="DeletDB">删除</button>
                    </div>
                </div>
            </div>
            <div class="panel panel-success">
                <div class="panel-heading">
                    <h3 class="panel-title">查询结果: {{listNum}} 条数据</h3>
                    <div>
                        <button type="button" class="btn btn-info" data-toggle="modal" data-target="#myModal"
                                onclick="get_all()">显示全部
                        </button>
                    </div>
                </div>
                <div class="panel-body">
                    <p>{{first}}</p>
                    ···<br>
                    ···
                    <br>
                    <p>{{end}}</p>

                </div>
            </div>
        </form>
    </div>
</div>
<!-- 模态框（Modal） -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                    &times;
                </button>
                <h4 class="modal-title" id="myModalLabel">
                    查询结果
                </h4>
            </div>
            <div class="modal-body">
                {% for line in lines %}
                    <p>{{line}}</p>
                    {% endfor %}
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭
                </button>

            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal -->
</div>
</body>
<script>
    if ({{ data.ifAdd }} == "1"){
    $('#ifAdd').attr('checked','checked')
    }else{
    $('#ifAdd').removeClass('checked')
    }
</script>
</html>